package java_DesignPattern.BehavioralPattern.StrategyPattern;

/**
 * 环境类
 */
public class SystemContext {

    //内聚策略
    private Strategy strategy;

    //构造方法设置策略
    public SystemContext(Strategy strategy) {
        this.strategy = strategy;
    }

    //设置策略
    public void setStrategy(Strategy strategy) {
        this.strategy = strategy;
    }

    //执行策略
    public void doStrategy() {
        strategy.doStrategy();
    }
}
